def real(z):
    """
    Returns the real part of a complex number or a matrix of complex numbers.

    Args:
        z (complex or list of lists of complex): The complex number or matrix of complex numbers to compute the real part of.

    Returns:
        float or list of lists of float: The real part of the input number or matrix of numbers.
    """
    if isinstance(z, complex):
        return z.real
    elif isinstance(z, float) or isinstance(z, int):
        return z
    elif isinstance(z, (list, tuple)):
        return [[elem.real for elem in row] for row in z]
    else:
        # Raise TypeError for unsupported input types
        raise TypeError("Input type not supported.") 

# Test cases for real() function
assert real(2+3j) == 2.0
assert real([[2+3j, 4-5j], [6+7j, 8-9j]]) == [[2.0, 4.0], [6.0, 8.0]]
assert real([[1, 2], [3, 4]]) == [[1, 2], [3, 4]]
assert real(5) == 5
assert real(2.5) == 2.5
